package com.example.demomk.Utils;

import android.graphics.Canvas;
import android.graphics.Paint;

public class PDFPageBuilder {
    private Canvas canvas;
    private Paint defaultPaint;

    public PDFPageBuilder(Canvas canvas, Paint defaultPaint) {
        this.canvas = canvas;
        this.defaultPaint = defaultPaint;
    }

    // 绘制表格
    public float drawTable(float startX, float startY, String[] headers, String[][] data, float[] columnWidths) {
        TableDrawer drawer = new TableDrawer(
                canvas,
                defaultPaint,
                4f,    // 单元格内边距
                1.2f,  // 行间距
                3      // 最大行数
        );
        return  drawer.drawTable(startX, startY, headers, data, columnWidths);
    }
    public float drawTableWithoutBorder(float startX, float startY, String[][] data, float[] columnWidths) {
        TableDrawer drawer = new TableDrawer(
                canvas,
                defaultPaint,
                4f,    // 单元格内边距
                1.0f,  // 行间距
                3      // 最大行数
        );
        return  drawer.drawTableWithoutBorder(startX, startY, data, columnWidths);
    }
}
